<template>
  <el-dialog id="bouncedBox" v-dialogDrag :title="title" :visible.sync="show" :width="width + '%'" class="closeIcon"
    :close-on-click-modal="false" :append-to-body="append" :fullscreen="fullscreen" @close="close">
    <div slot="title" class="el-dialog___header">
      <span class="el-dialog__title">
        {{ $t('文本编辑器') }}
      </span>
      <i class="el-icon-full-screen" @click="fullScreen()" />
    </div>

    <slot />
  </el-dialog>
</template>
<script>
export default {
  props: {
    title: {
      type: String,
      default: ''
    },
    dialogShow: {
      type: Boolean,
      default: false
    },
    width: {
      type: Number,
      default: 80
    },
    append: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      show: false,
      fullscreen: false
    }
  },
  watch: {
    dialogShow: function (val) {
      this.show = val
    }
  },
  methods: {
    fullScreen() {
      this.fullscreen = !this.fullscreen
      this.$emit('editorResize', '100vh')
    },
    close() {
      this.$emit('update:dialogShow', this.show)
    }
  }
}
</script>
<style lang="scss" scoped>
#bouncedBox {
  .el-dialog__headerbtn {
    right: 30px;
    top: 17px;
    width: 25px;
    height: 25px;
    background: url('../../assets/close.png') left no-repeat;
    background-size: cover;
  }

  .el-dialog__headerbtn i {
    font-size: 30px;
    visibility: hidden;
  }

  .el-dialog {
    border-radius: 12px;
  }

  .el-dialog__header {
    background: #fff !important;
    border-radius: 10px 10px 0 0 !important;
    padding: 15px 20px 1px;
    position: relative;
  }

  .el-dialog__title {
    color: var(--huocms-com-color-primary);
    font-size: 20px;
    font-weight: bold;
    line-height: 36px;
  }

  .el-dialog__title::before {
    display: inline-block;
    width: 4px;
    height: 20px;
    margin-right: 15px;
    border-radius: 4px;
    background-color: var(--huocms-com-color-primary);
    vertical-align: middle;
    content: '';
  }
}
</style>
